package com.we823.project.model.product;

import java.sql.Date;

import com.we823.project.model.repo.MaterialBomModel;

/**
 * 计划工序对象
 * 在生产计划生成时，根据BOM的基本信息生成这个对象
 * @author ZhangYinxian
 *
 */
public class PlanProcessModel {
	private Integer id;
	private String process;
	private String materialCode;
	private String materialModel;
	private String materialDesc;
	/**
	 * 根据生成计划的长度计算的数量
	 */
	private float needTotal=0;
	/**
	 * 计划需要的数量
	 */
	private float needNum=0;
	private String unit;
	private String station;
	private int stationId;
	private Date finishDate;
	private String description;
	private int calculateCode = 0;
	/**
	 * 计划长度
	 */
	private float planNum=0;
	
	public PlanProcessModel() {}
	
	public PlanProcessModel(MaterialBomModel materialBomModel, float planNum) {
		if (materialBomModel!=null) {
			this.process = materialBomModel.getProcess();
			this.materialCode = materialBomModel.getMaterialCode();
			this.materialModel = materialBomModel.getMaterialModel();
			this.materialDesc = materialBomModel.getMaterialDesc();
			this.needNum = materialBomModel.getNeedNum();
			this.unit=materialBomModel.getUnit();
			this.calculateCode = materialBomModel.getCaculateCode();
		}
		this.planNum=planNum;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getProcess() {
		return process;
	}

	public void setProcess(String process) {
		this.process = process;
	}

	public String getMaterialCode() {
		return materialCode;
	}

	public void setMaterialCode(String materialCode) {
		this.materialCode = materialCode;
	}

	public String getMaterialModel() {
		return materialModel;
	}

	public void setMaterialModel(String materialModel) {
		this.materialModel = materialModel;
	}

	public String getMaterialDesc() {
		return materialDesc;
	}

	public void setMaterialDesc(String materialDesc) {
		this.materialDesc = materialDesc;
	}

	public float getNeedTotal() {
		if (needTotal==0) {
			needTotal = needNum / calculateCode * planNum;
		}
		return needTotal;
	}

	public void setNeedTotal(float needTotal) {
		this.needTotal = needTotal;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getStation() {
		return station;
	}

	public void setStation(String station) {
		this.station = station;
	}

	public int getStationId() {
		return stationId;
	}

	public void setStationId(int stationId) {
		this.stationId = stationId;
	}

	public Date getFinishDate() {
		return finishDate;
	}

	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public float getNeedNum() {
		return needNum;
	}

	public void setNeedNum(float needNum) {
		this.needNum = needNum;
	}
	
}
